package cn.edu.sjtu.se.peakfactory.dao.impls.hibernate;

import java.util.List;

import org.hibernate.criterion.DetachedCriteria;
import org.hibernate.criterion.MatchMode;
import org.hibernate.criterion.Restrictions;

import cn.edu.sjtu.se.lchang.socialnetwork.dao.impls.hibernate.BaseDAOImpl;
import cn.edu.sjtu.se.peakfactory.dao.bean.Coupon;
import cn.edu.sjtu.se.peakfactory.dao.bean.UserCoupon;
import cn.edu.sjtu.se.peakfactory.dao.interfaces.CouponDAO;

public class CouponDAOImpl extends BaseDAOImpl<Coupon> implements CouponDAO {
	public List<Coupon> searchCouponByName(String couponName){
		DetachedCriteria criteria = DetachedCriteria.forClass(Coupon.class);
		criteria.add(Restrictions.like("name", couponName, MatchMode.ANYWHERE));
		return findByCriteria(criteria);
	}
}
